package main

import (
	"basic-go/src/arrays"
	"fmt"
)

func main() {

	queue := arrays.NewArrayQueue(5)
	fmt.Printf("queue size = %v\n", queue.Size())
	fmt.Printf("queue capacity = %v\n", queue.Capacity())

	for i := 1; i <= 10; i++ {
		err := queue.Push(i)
		if err != nil {
			fmt.Printf("i=%d\n", i)
			break
		}
	}

	fmt.Printf("queue size = %v\n", queue.Size())
	fmt.Printf("queue capacity = %v\n", queue.Capacity())

	for i := 1; i <= 10; i++ {
		e, err := queue.Pop()
		fmt.Printf("e=%v, err=%v\n", e, err)
		if err != nil {
			break
		}
		if i == 3 {
			_ = queue.Push(100)
		}
	}
}
